package com.zs.grain.ui

import android.app.Application
import androidx.lifecycle.MutableLiveData
import javax.inject.Inject
import com.zs.grain.service.*
import com.xnkj1688.semplibrary.mvvm.BaseViewModel


class AdjustViewModel @Inject constructor(
    val mApp: Application,
    val mDataService: DataService
) : BaseViewModel(mApp) {

    val remark = MutableLiveData<String>()
    val value = MutableLiveData<Double>()
    val min = MutableLiveData<Double>()
    val max = MutableLiveData<Double>()
    val ivalue = MutableLiveData<Int>()
    val imin = MutableLiveData<Int>()
    val imax = MutableLiveData<Int>()
    val unitType = MutableLiveData<String>()
    fun init(remark: String, min: Double, max: Double, value: Double, unitType: String) {
        this.remark.value = remark
        this.min.value = min
        this.max.value = max
        this.value.value = value
        this.imin.value = min.toInt()
        this.imax.value = max.toInt()
        this.ivalue.value = value.toInt()
        this.unitType.value = unitType
    }

    fun onClickConfirm() {
        uiNotify.value = this.getNotify("Confirm")
    }

    fun onClickCancel() {
        uiNotify.value = this.getNotify("Cancel")
    }
}